
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.spoto.oa.model.Employee" isELIgnored="false"%>
<%@ page import="com.spoto.oa.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<link href="style/v1/common/welcome.css" rel="stylesheet">
		<script type="text/javascript" src="js/lib/jquery-1.4.2.js">

</script>
		<script src="js/common/list.js" type="text/javascript">
		

</script>
<script src="js/common/welcome.js" type="text/javascript"></script>
<style type="text/css">
#welcome{
	margin-top:-20px;
}
</style>
	</head>

	<body>
		<div id="welcome">
		<h2>员工通讯录</h2>
		<div class="ope">

			<form class="form" action="ContactServlet?op_type=search" method="post">
				<input type="hidden" name="searchTypeValue" id="searchTypeValue"
					value="${searchType}" />
				<select name="searchType" id="searchType">

					<option selected="selected">
						员工帐号
					</option>
					<option>
						员工姓名
					</option>
					<option>QQ</option>
					<option>手机</option>

				</select>
				<input type="text" class="infor" name="infor" value="${infor}">
				<input type="submit" value="查询" class="search">
			</form>
		</div>

			<%
				Object ob = request.getAttribute("employees");
				if (null != ob) {
					PageUtil pc = new PageUtil();
					String searchType = request.getParameter("searchType");
					String type = request.getParameter("op_type");
					String info = request.getParameter("infor");
					pc.setCurrentPage(request.getParameter("page")); //设置当前页面
					pc.setPageCount(3); //设置每页记录数
					pc.setRecordCount(((List<Employee>) ob).size()); //设置记录条数
					pc.setPageUrl("ContactServlet?op_type=" + type + "&searchType="
							+ searchType + "&infor=" + info); //设置跳转页面url
					List<Employee> employees = pc.getSubList((List<Employee>) ob); //获取当前页面记录
					if (employees.isEmpty()) {
			%>
			<center>
				不存在该用户
			</center>
			<%
				} else {
			%>
			<div id="list">
				<div class="view">
					<form action="EmployeeServlet" method="post">
					
						<div id="table-ope-right">
							<%=pc.getPageJumpLinkHtml()%>

						</div>
						<div id="c"></div>
						<table class="table">
							<tr class="firstrow">
								<td>
									员工帐号
								</td>
								<td>
									员工姓名
								</td>
								<td>
									性别
								</td>
								<td>
									员工角色
								</td>
								<td>
									手机
								</td>
								<td>
									电子邮箱
								</td>
								<td>QQ</td>
							</tr>
							<%
								int i = 0;
										for (Employee e : employees) {
											i++;
							%>


							<tr>
								<td style="text-align: left">
									<a
										href="ContactServlet?op_type=to_listDetail&username=<%=e.getUsername()%>">
										<%
											out.print(e.getUsername());
										%>
									</a>


								</td>
								<td>
									<%
										out.print(e.getName());
									%>
								</td>
								<td>
									<%=e.getSex()%>
								</td>
								<td>
									<%
										if (e.getIsAdmin().equals("是")) {
									%>
									管理员
									<%
										} else if (e.getIsAdmin().equals("否")) {
									%>
									普通员工
									<%
										}
									%>
								</td>
								<td>
									<%
										out.print(e.getCell());
									%>
								</td>
								<td>
									<%=e.getEmail()%>
								</td>
								<td>
								<%=e.getQq() %>
								
								</td>
							</tr>


							<%
								}
							%>

						</table>
					</form>
					<div class="page-no">
						<ul>
							<%=pc.getJavaScriptJumpCode()%>
							<li id="statue">
								<%=pc.getPageCountHtml()%>
							</li>
							<li class="jump">
								<%=pc.getPageFormJumpHtml()%>
							</li>
						</ul>

					</div>	
				</div>
				<%
					}
					}
				%>
			</div>


		</div>

	</body>
</html>
